ENT.Type = "anim"
ENT.Base = "base_gmodentity"
 
ENT.PrintName		= "BASE"
ENT.Author			= "x-quake"
ENT.Contact			= "NA"
ENT.Purpose			= "CODING"
ENT.Instructions	= "START WITH THIS"


//HatModel = "models/props_junk/TrafficCone001a.mdl"

//Edit this file to accord for Item TYPES and change the bones accordingly. For the BODY types (Wings) add the animation code. Make sure Shoes, Arms, and Hands are on both sides of the player.

if SERVER then

	function ENT:Initialize()

		//The server calls this when the  entity has been spawned and activated
	
	end
	
	function ENT:AcceptInput( INPUT, ACTIVATOR, CALLER )
	
		//This is called when an input is triggered on the entity, with ENT:input()
		//INPUT is the string name of the input, ACTIVATOR and CALLER are entities
	
	end

	function ENT:StartTouch( ent )
	
		//Called when the entity touches another entity (not world)
	
	end
	
	function ENT:EndTouch( ent )
	
		//Called when the entity ceases touching another entity
	
	end
	
	function ENT:Touch( ent )
	
		//Called when the SENT comes into contact with another entity
	
	end
	
	function ENT:KeyValue( key, value )
	
		//This is called BEFORE initialize is called.
		//Called when a key value is set up, either through ENT:SetKeyValue() or on map start.
	
	end
	
	function ENT:OnRemove()
	
		//Called when the SENT is removed
	
	end
	
	function ENT:OnRestore()
	
		//Called when a save-game is loaded
	
	end
	
	function ENT:OnTakeDamage( dmginfo )
	
		//Called when the SENT takes damage. Doesn't call on vehicles and sometimes just never calls.
		//dmginfo is the following, used similar to a traceres
		
		/*
		DamageInfo.AddDamage	Adds damage to the current damage amount.
		DamageInfo.GetAmmoType	Which ammotype has done this damage?
		DamageInfo.GetAttacker	Returns the attacker.
		DamageInfo.GetBaseDamage	Gets the base damage. Appears to return the same value as GetDamage.
		DamageInfo.GetDamage	Amount of damage inflicted.
		DamageInfo.GetDamageForce	Returns the force that the bullet (or whatever) has.
		DamageInfo.GetDamagePosition	Origin of the damage.
		DamageInfo.GetInflictor	Returns the Inflictor, in most cases the Attacker.
		DamageInfo.GetMaxDamage	Returns the maximum damage possible.***
		DamageInfo.GetReportedPosition	Where is the bullet hitpos.* **
		DamageInfo.IsBulletDamage	Did a bullet deal the damage?
		DamageInfo:IsDamageType	If a designated type of damage is taken, returns true. Use value from list: Damage Type
		DamageInfo.IsExplosionDamage	If explosion damage is taken, returns true.
		DamageInfo.IsFallDamage	If fall damage is taken, returns true.
		DamageInfo.ScaleDamage	Scales a damage by a number (scalar).
		DamageInfo.SetAttacker	Sets which entity (usually a player or a NPC) should be credited for the damage.
		DamageInfo.SetDamage	Sets the damage to another value.
		DamageInfo.SetDamageForce	Sets the force of the damage (vector).
		DamageInfo.SetInflictor	Sets which entity or weapon dealt the damage.
		DamageInfo.SubtractDamage	Subtracts a number from the damage.
		*/
	end
	
	function ENT:PhysicsCollide( data, physobj )
	
		//Called when the SENT collides with something, tells it what to do. BE CAREFUL HERE.
		
		//data is a table, containing:
		/*
		Entity HitEntity
		The hit entity is what the scripted entity collided with. In addition to props, vehicles, etc., HitEntity is often a part of the level. You can check whether or not the Hit Entity is part of the level or not with the IsWorld() function.
		Vector HitPos
		This appears to be the position this entity was at when it collided with HitEntity.
		Vector OurOldVelocity
		Before colliding with HitEntity, OurOldVelocity was this entity's velocity.
		PhysObj HitObject
		This is a specific physics object on HitEntity that we collided with. This is important because some entities have multiple physics objects, such as ragdolls.
		float DeltaTime
		DeltaTime is how long (in seconds) it has been since this entity last collided with something. PhysicsCollide can easily be called 50 or 60 times a second, and Delta Time can be used to control how often something (such as impact sounds) happen.
		Vector TheirOldVelocity
		This was the velocity of HitEntity before it collided with this entity.
		float Speed
		Speed is a positive number describing how "fast" (or perhaps more accurately, how hard) the two entities collided (this also applies to when this entity is frozen and HitEntity is moving instead).
		Vector HitNormal
		This is a normalized normal; you can think of this as being the "facing direction" of the surface this entity hit on HitEntity.
		*/
		
		//physobj has a library of functions, look them up.
	
	end
	
	function ENT:PhysicsSimulate( phys, deltatime )
	
		//Officially the most complicated callback in the whole mod.
		/*
		Returns 3 variables..
		1. A SIM_ enum
		2. A vector representing the linear acceleration/force
		3. A vector representing the angular acceleration/force
		If you're doing nothing you can return SIM_NOTHING
		You need to call Entity.StartMotionController to tell the entity to start calling this function..
		*/
		
		//Look at gmod_thruster for example
	
	end
	
	function ENT:PhysicsUpdate( phys )
	
		//Called everytime the physics is updated on the SENT, probably ever frame the SENT is awake
	
	end
	
	function ENT:PreEntityCopy()
	
		//Called before the duplicator copies an entity
	
	end
	
	function ENT:PostEntityCopy()
	
		////Called after the duplicator copies an entity
	
	end
	
	function ENT:PostEntityPaste( PLAYER, ENT, createdents )
	
		//Called after the duplicator pastes an entity
		
		//PLAYER is the person who pasted, ENT is a table, ad createdents is a table
	
	end
	
	function ENT:SpawnFunction( ply, tr )
	
		//Called when a player presses the button in the spawn menu to spawn this SENT in the Sandbox gamemode.
		//In here you should create your entity using ents.Create() and spawn it inside the world.
		
		/*
		This function is only called in the Sandbox gamemode and is only called on SENTs.
		If you do not put this function in your SENT you will not be able to spawn it from the spawn menu.
		You must return the entity you spawned from inside the function.
		*/
		
		//RETURN THE SENT with return ent (if the local entity was named ent)
		
		//EXAMPLE
		/*
		function ENT:SpawnFunction( ply, tr )
			if ( !tr.Hit ) then return end
			local ent = ents.Create( self.GetClass() )
				ent:SetPos( tr.HitPos + tr.HitNormal * 16 ) 
				ent:Spawn()
				ent:Activate()
 
			return ent
		end 
		*/
	
	end
	
	function ENT:Think()
	
		//Called everytime the SENT thinks
		//Can be expensive with a lot of code inside of this
	
	end
	
	function ENT:UpdateTransmitState( ent )
	
		//Called to change the transmit state of the SENT
		
		//If this is at TRANSMIT_PVS, it only transmits once.
		
		/*
		TRANSMIT_PVS - Only send when in the PVS (aka in Players View) - The default value
		TRANSMIT_ALWAYS - Always Send
		TRANSMIT_NEVER - Never Sen
		*/
	
	end
	
	function ENT:Use( activator, caller )		//Clean this up
	
		//Called when the SENT is used
		
		/*
		Examples

		Description	When a player uses the SENT, it will remove itself and the player will gain 5 HP.
		Used on:	
		Code	
 
		function ENT:Use( activator, caller )
 
			self.Entity:Remove()
 
			if ( activator:IsPlayer() ) then
 
				// Give the collecting player some free health
				local health = activator:Health()
				activator:SetHealth( health + 5 )
 
			end
 
		end
 
		Output	more health, less entity
		[edit] Additional Info

		The use key is the identifier of who activated the entity.
		This function will be called as long as you keep holding down the USE key on the entity.
		To modify this behavior, use Entity:SetUseType along with the USE_* enumerations like SIMPLE_USE (Just calls this function one time once you pressed USE on it)
		*/
		
		/*
		Examples

		Description	Makes the ENT.Use hook only get called once at every use.
		Used on:	
		Code	
		
		Entity:SetUseType(SIMPLE_USE)
		
		Output	None.
		[edit]Additional Notes

		These are the states that a button can be:
		CONTINUOUS_USE  = 0	// Default, like a medikit 
		ONOFF_USE       = 1 
		DIRECTIONAL_USE = 2	// Like a wheel turning 
		SIMPLE_USE      = 3	// Single press, usually used with [[ENT.Use]]
		*/
	
	end

end



if CLIENT then

	function ENT:Initialize()
	
		//Called right before the SENT spawns
	
	end
	
	function ENT:CalcView( PLY, Origin, Angles, FieldOfView )
	
		//Calculates the players view when set with Player:SetScriptedView()
	
	end
	
	function ENT:Draw()
	
		//Called to draw the entity
		//Use ENT:DrawModel()
	
	end
	
	function ENT:IsTranslucent()
	
		//Returns true if the entity is translucent
	
	end
	
	function ENT:OnRemove()
	
		//Called when the SENT is removed
	
	end
	
	function ENT:OnRestore()
	
		//Called when a save-game is loaded
	
	end
	
	function ENT:PhysicsUpdate( phys )
	
		//Called everytime the physics is updated on the SENT, probably ever frame the SENT is awake
	
	end
	
	function ENT:Think()
	
		//Called each time the SENT thinks, don't put a lot of code here or it could be expensive
	
	end


end